import request from '@/utils/request'
import { AxiosResponse } from 'axios'
import { RecruitProcessType, GetRecruitProcessAndJobRes } from './type'

enum PROCESS_API {
  GET_MINE_PROCESS = '/recruitProcess/getMine',
  POST_PROCESS = '/recruitProcess/add',
}

/**
 * 求职者获取我的投递
 * @returns
 */
export const reqGetMyProcess = () =>
  request.get<any, AxiosResponse<GetRecruitProcessAndJobRes>>(
    PROCESS_API.GET_MINE_PROCESS,
  )

/**
 * 添加招聘流程
 * @param {object} params RecruitProcess
 * @param {number} params.id
 * @param {number} params.jobId
 * @param {number} params.resumeId
 * @param {number} params.status
 * @param {string} params.feedback
 * @param {object} params.createTime
 * @returns
 */
export const reqAddProcess = (data: RecruitProcessType) =>
  request.post<any, AxiosResponse<any>>(PROCESS_API.POST_PROCESS, data)
